package com.example.dicomviewer.utils;

public class NumTransUtil {
    public static int oldValue2NumIn256(int oldValue) {
        return (oldValue + 16777216) / 65793;
    }

    public static float[] normalizeRGB(float[] color) {
        float sum = (float) Math.sqrt(color[0] * color[0] + color[1] * color[1] + color[2] * color[2]);
        float[] newColor = new float[4];
        for (int i = 0; i < 3; ++i) {
            newColor[i] = color[i] / sum;
        }
        newColor[3] = color[3];
        return newColor;
    }
}
